<form action="" class="form-horizontal" role="form">
  <div class="form-group">
    <label class="col-sm-2 control-label">主题名称</label>
    <div class="col-sm-2">
      <input type="text" class="form-control" name="name" placeholder="" datatype="*">
    </div>
  </div>
  <div class="form-group">
    <label class="col-sm-2 control-label">主题模板目录</label>
    <div class="col-sm-2">
      <input type="text" class="form-control" name="template" placeholder="" datatype="*">
    </div>
  </div>
  <div class="form-group">
    <label class="col-sm-2 control-label">主题风格目录</label>
    <div class="col-sm-2">
      <input type="text" class="form-control" name="style" placeholder="" datatype="*">
    </div>
  </div>
  <div class="form-group">
    <label class="col-sm-2 control-label">主题预览图片</label>
    <div class="col-sm-5">
      <input type="text" id="image" name="image" class="form-control margin-bottom" /><input type="file" name="file_upload" id="image_upload" />
    </div>
  </div>
  <div class="form-group">
    <label class="col-sm-2 control-label">样式设置</label>
    <div class="col-sm-5">
      <textarea class="form-control" rows="6" name="config" placeholder=""></textarea>
    </div>
  </div>
  <div class="form-group">
    <label class="col-sm-2 control-label">适用模型</label>
    <div class="col-sm-2">
      <select class="form-control" name="model_id" id="partner">
        {$modelOptions}
      </select>
    </div>
  </div>
  <div class="form-group">
    <label class="col-sm-2 control-label">所属合作商</label>
    <div class="col-sm-2">
      <select class="form-control" name="partner" id="partner">
        {$partnerOptions}
      </select>
    </div>
  </div>
  <div class="form-group">
    <label class="col-sm-2 control-label">所属客户</label>
    <div class="col-sm-2">
      <select class="form-control" name="customer" id="customer">
        {$customerOptions}
      </select>
    </div>
  </div>
  <div class="form-group">
    <div class="col-sm-offset-2 col-sm-8">
      <button type="submit" class="btn btn-primary" data-loading-txt="提交中，请稍后……" data-ajax-url="__CONTROLLER__/addPost">保存更改</button>
    </div>
  </div>
</form>
<!-- uploadify -->
<link rel="stylesheet" href="__PUBLIC__/Style/Common/uploadify/uploadify.css">
<script type="text/javascript" src="__PUBLIC__/Style/Common/uploadify/jquery.uploadify.min.js?{:rand(0,9999)}">
</script>
<script type="text/javascript">
  $(function(){
    $("#image_upload").uploadify({
      'multi': false,
      'fileSizeLimit'  : '200kb',
      'buttonText'     : '选择图片',
      'fileTypeDesc'   : 'Image Files',
      'fileTypeExts'   : '*.jpg; *.png',
      'swf'            : '__PUBLIC__/Style/Common/uploadify/uploadify.swf',
      'uploader'       : '__MODULE__/Upload/uploadOne',
      'onUploadSuccess': function(data, res) {
        var url = eval("(" + res + ")").extra.url;
        $("#image").val(url);
      }
    });
    $('#image').imagePreview();
  });
</script>
<script type="text/javascript">
  $(function(){
    $("#partner").change(function(){
      var v = $(this).val();
      $.post("__CONTROLLER__/getCustomerPost", {
        partner: v
      }, function(data){
        $("#customer").html(data);
      });
    });
  });
</script>
